[CENTER][SIZE="5"][B]Changeable Weapon Abilities[/B][/SIZE][/CENTER]

[SIZE="2"][b]This package will allow you to change weapons so that individual weapon abilities become properties of a weapon.  This means that you will be able to view and change a weapon's abilities via the [props command, as well as implement various ways for your players to change their weapons' abilities.

I have created and am including Weapon Ability Deeds that a player can use to "learn" a new weapon ability.  The deeds are designated "Primary Ability Deed", "Secondary Ability Deed", etc., and each will change an ability one time for one individual weapon.  I have also created and am including an NPC WeaponsMaster that will sell the deeds to players.  You can edit the selling price in the SBWeaponsMaster.cs script, and you may simply reference the SBWeaponsMaster.cs script in any other NPC vendor that you wish to have sell the deeds.

When the deed is double-clicked while a player is holding a weapon, a gump appears with buttons for each available special move.  If you utilize more or less special moves, this gump may need to be edited to suit your shard.  The player then selects the special move to adhere to the weapon and the deed is used up.  By default, some special moves aren't allowed on some weapons.  For instance, the Infectious Strike move is not allowed on bashing weapons or ranged weapons (ranged weapons can use Serpent Arrow).  You can view these limitations within the _AttacksGump.cs scripts and change them to your liking.

Screenshots of the deed, gump and WeaponsMaster NPC are included.[/b][/SIZE]


[color="Red"][SIZE="3"][B]NOTICE!!![/B][/SIZE][/color]

This package of scripts are to be used as an addition to Gargouille's scripts and distro modifications for Custom Weapon Abilities as referenced here:  [u][i][url]http://www.runuo.com/forums/custom-script-releases/93672-runuo-2-0-rc1-customizable-weaponabilities.html[/url][/i][/u].  Please do not try to install this package without first making the necessary changes to your server to enable customizable weapon abilities.

* In the Custom Weapon Abilites package from Gargouille, the reference to the "Fourth" ability is misspelled as "Forth".  Lord_Greywolf patterned his additions after the spelling "Forth".  As my scripts use the term "Fourth", you will either need to change the references in my scripts to "Forth" or change the references in Gargouille's scripts to the correct spelling, "Fourth".  I found this too late in the game to go back and change all of my scripts, so instead chose to do a Quick Find & Replace on the four scripts in Gargouille's and Lord_Greywolf's package to substitute in the correct spelling.

[SIZE="3"][COLOR="DarkOrange"][B]THANKS!!![/B][/COLOR][/SIZE]

Thanks to Jeff and Lord_Greywolf for the extreme amounts of help given to a newbie (me) to get these things to work as desired.  And thanks again to Gargouille for making the impossible possible (client-side limitations, bah!).

[COLOR="SeaGreen"][B][SIZE="3"]INSTALLATION:[/SIZE][/B][/COLOR]

It is necessary, in addition to enabling the customizable weapon abilities, to edit BaseWeapon.cs, WeaponEnums.cs and EACH weapon script.  It is not necessary to edit artifact weapons that utilize a weapon script as a base.  I have included pre-edited weapon scripts for both installations without Malganis' Mondain's Legacy and with Malganis' Mondain's Legacy.  These edited weapon scripts are "stock" except for the edits described here, and may simply replace your current weapon scripts if you have not already modified them.  Each custom weapon you may have made needs to have the same change made to it.

[b]First, add this to Scripts\Items\Weapons\WeaponEnums.cs within the namespace, below the weapon animations:[/b]
[code]
public enum WeaponAbilityName
    {
        None = 0,
        ArmorIgnore,
        BleedAttack,
        ConcussionBlow,
        CrushingBlow,
        Disarm,
        Dismount,
        DoubleStrike,
        InfectiousStrike,
        MortalStrike,
        MovingShot,
        ParalyzingBlow,
        ShadowStrike,
        WhirlwindAttack,
        RidingSwipe,
        FrenziedWhirlwind,
        Block,
        DefenseMastery,
        NerveStrike,
        TalonStrike,
        Feint,
        DualWield,
        DoubleShot,
        ArmorPierce,
        Bladeweave,
        ForceArrow,
        LightningArrow,
        PsychicAttack,
        SerpentArrow,
        ForceOfNature
    }
[/code]

[b]Next comes the changes to Scripts\Items\Weapons\BaseWeapon.cs[/b]

In the Var Declarations Region (which begins ~ line 60), add this:
[code]
        // Addition for Custom Weapon Abilities - add as many abilities as you need for your shard
        private WeaponAbilityName m_PrimaryAbilityName;
        private WeaponAbilityName m_SecondaryAbilityName;
        private WeaponAbilityName m_ThirdAbilityName;
        private WeaponAbilityName m_FourthAbilityName;
        private WeaponAbilityName m_FifthAbilityName;
[/code]

In the Virtual Properties Region (which begins ~ line 98 normally), change this:
[code]
		public virtual WeaponAbility PrimaryAbility{ get{ return null; } }
		public virtual WeaponAbility SecondaryAbility{ get{ return null; } }
[/code]
to this:
[code]
        public virtual WeaponAbility PrimaryAbility { get { return m_WeaponAbilities[(int)PrimaryAbilityName]; } }
        public virtual WeaponAbility SecondaryAbility { get { return m_WeaponAbilities[(int)SecondaryAbilityName]; } }
        public virtual WeaponAbility ThirdAbility { get { return m_WeaponAbilities[(int)ThirdAbilityName]; } }
        public virtual WeaponAbility FourthAbility { get { return m_WeaponAbilities[(int)FourthAbilityName]; } }
        public virtual WeaponAbility FifthAbility { get { return m_WeaponAbilities[(int)FifthAbilityName]; } }
[/code]

In the Getters & Setters Region (which begins ~ line 147 normally), add these for as many abilities as you need:
[code]
       [COLOR="Green"]// Added in for Custom Weps Abilities[/COLOR]
        [CommandProperty(AccessLevel.GameMaster)]
        public WeaponAbilityName PrimaryAbilityName
        {
            get { return m_PrimaryAbilityName; }
            set { m_PrimaryAbilityName = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public WeaponAbilityName SecondaryAbilityName
        {
            get { return m_SecondaryAbilityName; }
            set { m_SecondaryAbilityName = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public WeaponAbilityName ThirdAbilityName
        {
            get { return m_ThirdAbilityName; }
            set { m_ThirdAbilityName = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public WeaponAbilityName FourthAbilityName
        {
            get { return m_FourthAbilityName; }
            set { m_FourthAbilityName = value; }
        }

        [CommandProperty(AccessLevel.GameMaster)]
        public WeaponAbilityName FifthAbilityName
        {
            get { return m_FifthAbilityName; }
            set { m_FifthAbilityName = value; }
        }
        [COLOR="Green"]// End Addition[/COLOR]
[/code]

Then in the Serialization/Deserialization Region (normally ~ line 2375)...
Under "public override void Serialize( GenericWriter writer )", change this:
[code]
			writer.Write( (int) [color="Blue"]8[/color] ); // version

			SaveFlag flags = SaveFlag.None;
[/code]
to this:
[code]
			writer.Write( (int) [color="Blue"]9[/color] ); // version

[color="Blue"]            writer.Write((int)m_PrimaryAbilityName);
            writer.Write((int)m_SecondaryAbilityName);
            writer.Write((int)m_ThirdAbilityName);
            writer.Write((int)m_FourthAbilityName);
            writer.Write((int)m_FifthAbilityName);[/color]

			SaveFlag flags = SaveFlag.None;
[/code]

And Under "public override void Deserialize( GenericReader reader )", just above "case 8:" add this:
[code]
                case 9:
                    {
                        m_PrimaryAbilityName = (WeaponAbilityName)reader.ReadInt();
                        m_SecondaryAbilityName = (WeaponAbilityName)reader.ReadInt();
                        m_ThirdAbilityName = (WeaponAbilityName)reader.ReadInt();
                        m_FourthAbilityName = (WeaponAbilityName)reader.ReadInt();
                        m_FifthAbilityName = (WeaponAbilityName)reader.ReadInt();

                        goto case 8;
                    }  
[/code]

[b]In [u]each[/u] weapon script you need to comment out the Weapon Ability Overrides![/b]
Example, Broadsword.cs:
[code]
	public class Broadsword : BaseSword
	{
		[color="Green"]//public override WeaponAbility PrimaryAbility{ get{ return WeaponAbility.CrushingBlow; } }[/color]
		[color="Green"]//public override WeaponAbility SecondaryAbility{ get{ return WeaponAbility.ArmorIgnore; } }[/color]

		public override int AosStrengthReq{ get{ return 30; } }
		public override int AosMinDamage{ get{ return 14; } }
		public override int AosMaxDamage{ get{ return 15; } }
		public override int AosSpeed{ get{ return 33; } }
		...
[/code]
Or, as explained above, if you do not have any other weapon edits or if this is a fresh installation, you can simply replace your weapon scripts with the ones I have included with the files.

Finally, simply drop the Changeable Weapon Abilities folder into your customs, and add the WeaponsMaster NPC to sell the deeds.

Attached files:
Changeable Weapon Abilities.zip
Weps With ML Installed.zip
Weps Without ML Installed.zip
SampleBaseWeapon.cs
SampleWeaponEnums.cs